feature: Update Image.getSize/getSizeWithHeaders methods to return a promise - #42895
feature: Update Image.getSize/getSizeWithHeaders methods to return a promise#42895retyui wants to merge 1 commit into
Image.getSize/getSizeWithHeaders methods to return a promise#42895Conversation
Image.getSize method to return a promiseImage.getSize/getSizeWithHeaders methods to return a promise
This comment was marked as outdated.
This comment was marked as outdated.
|
/rebase - this commet will rebase the PR on top of main automatically. All these changes are JS changes only, there is no reason why the native builds should fail. Let's see if a rebase fixes CI. |
Base commit: c1b8f37 |
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
the |
|
I was looking into that. There is an internal E2E test that is failing and I need to understand why. I'll probably look into it tomorrow morning, as the day is almost over and I have another meeting coming up. :( |
|
This pull request was successfully merged by @retyui in 2c1bcba. When will my fix make it into a release? | Upcoming Releases |
Summary:
Image.getSize/getSizeWithHeadersare still working in old fashioned "callback" wayBut in 2024 more developers prefer use async/await syntax for asynchronous operations
So, in this PR I added support for Promise API with backward compatibility, modern way:
Changelog:
[GENERAL] [ADDED] -
Image.getSize/getSizeWithHeadersmethod returns a promise if you don't pass asuccesscallbackTest Plan:
a.
node_modules/react-native/Libraries/Image/Image.android.jsb.
node_modules/react-native/Libraries/Image/Image.ios.js